package edu.yngsxy.demo.controller;

import edu.yngsxy.demo.lanjieqi.Lanjieqi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private Lanjieqi lanjieqi;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加拦截器并指定需要拦截的路径和排除的路径
        registry.addInterceptor(lanjieqi) .excludePathPatterns("/**/*.png","/**/*.jpg","/**/*.jpeg"
                        ,"/**/*.js","/**/*.css","/static/images/*.jpg");//不需要拦截的
    }
}
